# -*- coding: utf-8 -*-

'''
Created on 2011-9-30

@author: deadblue
'''

from os import path
from google.appengine.ext.webapp import template

class Page(object):
    def __init__(self, tplname):
        tplpath = path.dirname(__file__)
        tplpath = path.join(tplpath, 'templates')
        self.tplname = path.join(tplpath, tplname)

    def render(self, vars=None):
        return template.render(self.tplname, vars)

    def write(self, out, vars=None):
        out.write(self.render(vars))
